/**
 * @file event.h
 *
 * Event management.
 *
 * @date 1998 - 2011
 * @author Richard Delorme
 * @version 4.1
 */

#ifndef EDAX_EVENT_H
#define EDAX_EVENT_H

/** Event management data */
typedef struct Event {
	volatile bool loop;         /*< flag allowing to loop, waiting for events */
	char **ring;                /*< ring of buffers */
	int size;                   /*< size of the buffer ring */
	int first;                  /*< first position in the ring */
	int end;                    /*< one past the last position in the ring */
	SpinLock spin;              /*< spin lock */
	Thread thread;              /*< thread */
} Event;                        /*< messages */

void event_init(Event*);
void event_free(Event *event);
char *event_peek_message(Event *event);
bool event_exist(Event *event);

#endif /* EDAX_EVENT_H */

